package com.zxl.cityservice.controller;

import com.google.gson.Gson;
import com.zxl.cityservice.entity.Customer;
import com.zxl.cityservice.service.CustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

/**
 * Created by 逍遥的熊 on 2017/4/24.
 */

@Controller
@RequestMapping("/cust")
public class CustomerController {

    Gson gson = new Gson();

    @Autowired
    private CustomerService customerService;

    @RequestMapping("/allcust")
    @ResponseBody
    public String allcust(){
        List<Customer> list = customerService.getAll(0,10000000);
        return gson.toJson(list);
    }

    @RequestMapping("/report")
    public ModelAndView report(){
        ModelAndView mv = new ModelAndView("custom/custReport");
        return mv;
    }
}
